package sctu.edu.java.year2016.team04.luoxinghua.Projectmain;

import java.io.IOException;
import java.util.Scanner;

import static sctu.edu.java.year2016.team04.luoxinghua.Projectmain.Main.*;

/**
 * Created by 落叶的思恋 on 2016/6/21.
 */

public class HomePage {
    public static void main(String[] args) throws IOException {
        Scanner scanner = new Scanner(System.in);
        Main main = new Main();
        while (true) {
            Main.Engineer engineer = main.new Engineer();
            Main.User user = main.new User();
            main.probtype();
            main.ChooseId();
            if (SavetheUserOptions.equals("工程师")) {
                while (true) {
                engineer.engineerinterface();
                    engineer.decsiionWork();

                    if (main.selectwork.equals("查看留言")) {
                        engineer.lookleaveword();
                    } else if (main.selectwork.equals("添加内容")) {
                        engineer.Engineermap();
                    } else if (main.selectwork.equals("修改工程师联系方式")) {
                        engineer.userappointment();
                    } else {
                        System.out.println("你在逗我嘛，请重新输入");
                    }
                    if (returnlayer.equals("不返回")) {
                        System.out.println("再见工程师");
                        break;
                    }

                }

            } else {
                if (SavetheUserOptions.equals("客户")) {
                    while (true) {

                        user.userinterface();
                        if (main.userneedoperate.equals("搜索问题")) {
                            user.Usermap();
                        }
                            if (main.userneedoperate.equals("查看工程师联系方式")) {
                                user.userappointment();
                            } else if (main.userneedoperate.equals("留言")) {
                                user.userleaveword();
                            }
                         else if (main.userneedoperate.equals("人工服务")) {
                            user.handleserivceEngineer();
                        }

                        if (userYN.equals("否")) {
                            break;
                        }
                    }


                }
            }
            System.out.println("你是否想换个角色（“是”“否”）");
            String mainYN = scanner.nextLine();
            if (mainYN.equals("否")) break;


        }
        main.Unload();
        System.out.println("谢谢您的到来，希望对您有所帮助");


    }
}
